package com.gitee.ywj1352.nettyserver.handler;

import com.gitee.ywj1352.nettyserver.FirstDemo;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

/**
 * 业务 handler
 */
public class ServerProcessHandler extends SimpleChannelInboundHandler<FirstDemo.Demo> {

    public static final Logger LOGGER = LoggerFactory.getLogger(ServerProcessHandler.class);

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, FirstDemo.Demo requestDemo) throws Exception {
        LOGGER.info("get user message is {}" , requestDemo.toString());

        channelHandlerContext.writeAndFlush("ok");
    }
}
